package com.ooqiu.gaming.api;

import com.alibaba.fastjson.JSONObject;
import com.ooqiu.gaming.api.base.BaseRequest;
import com.ooqiu.gaming.api.base.BaseResponse;
import com.ooqiu.gaming.api.entities.ArticleListRes;
import com.ooqiu.gaming.api.entities.CateRes;
import com.ooqiu.gaming.common.Constants;
import com.ooqiu.gaming.common.entities.GamingUser;

import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import retrofit2.http.Path;

/**
 * @author Eenie
 * @date 2017/11/21
 */

public interface GamingService {


    //    @POST(Constants.PATH)
//    Observable<GamingUser> Login(@FieldMap Map<String, Object> params);
//
    @POST(Constants.PATH)
    @FormUrlEncoded
    Observable<ArticleListRes> fetchArticleList(@FieldMap Map<String, Object> params);

    @POST(Constants.PATH)
    @FormUrlEncoded
    Observable<JSONObject> fetchData(@FieldMap Map<String, Object> params);

    @POST("/v1/api/register")

    @FormUrlEncoded
    Observable<String> register(@FieldMap Map<String, Object> params);

    @POST("/v1/api/code")
    @FormUrlEncoded
    Observable<String> fetchCode(@FieldMap Map<String, Object> params);

    @POST("/v1/api/loginCheck")
    @FormUrlEncoded
    Observable<GamingUser> login(@FieldMap Map<String, Object> params);

    @POST("/v1/api/news/category")
    @FormUrlEncoded
    Observable<CateRes> fetchNewsCate(@FieldMap Map<String, Object> params);

    @POST("v1/api/news/all")
    @FormUrlEncoded
    Observable<ArticleListRes> fetchNewsList(@FieldMap Map<String, Object> params);

    @POST("v1/api/user/info")
    @FormUrlEncoded
    Observable<GamingUser> fetchProfile(@FieldMap Map<String, Object> params);

    @POST("v1/api/user/update")
    @FormUrlEncoded
    Observable<GamingUser> editProfile(@FieldMap Map<String, Object> params);

    @POST("v1/api/advise")
    @FormUrlEncoded
    Observable<GamingUser> feedback(@FieldMap Map<String, Object> params);

    @POST("v1/api/{path}")
    Observable<BaseResponse> postData(@Path(value = "path") String path, @Body BaseRequest request);


}
